package com.lti.appnet.module.event;

import com.lti.appnet.module.domain.Category;
import com.lti.appnet.module.repository.CategoryRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * Created by sinceow on 2014/7/30.
 */
@Service
public class CategoryReadEvent {

    @Autowired
    CategoryRepository categoryRepository;

    public List<Category> getModuleCategoies(String moduleId){
        return categoryRepository.findByModuleId(moduleId);
    }

    public List<Category> getAuthorCategories(String authorId){
        return categoryRepository.findByAuthorId(authorId);
    }

    public List<Category> getCategoriesByModuleAndAuthor(String moduleId, String authorId){
        return categoryRepository.findByModuleIdAndAuthorId(moduleId, authorId);
    }
}
